
function onCAMOV(obj)
{
	obj.src = "image/cbranch_a_e_2.gif";
}
function onCAMOT(obj)
{
	obj.src = "image/cbranch_a_e_1.gif";
}
function onCBMOV(obj)
{
	obj.src = "image/cbranch_b_e_2.gif";
}
function onCBMOT(obj)
{
	obj.src = "image/cbranch_b_e_1.gif";
}
function onRAMOV(obj)
{
	obj.src = "image/rbranch_a_e_2.gif";
}
function onRAMOT(obj)
{
	obj.src = "image/rbranch_a_e_1.gif";
}
function onRBMOV(obj)
{
	obj.src = "image/rbranch_b_e_2.gif";
}
function onRBMOT(obj)
{
	obj.src = "image/rbranch_b_e_1.gif";
}


function ormov(id)
{
	if(id<rims.length && rims[id] != null)
	{
		if(res[id] == -1)
		{
			onRAMOT(rims[id]);
		}
		else if(res[id] == -2)
		{
			onRBMOT(rims[id]);
		}
	}
	rls[id].style.background = '#4D994C';
	rls[id].style.color = '#ffffff';
	if(rfs[id]>=0)
	{
		ormov(rfs[id]);
	}
}
function ormot(id)
{
	if(id<rims.length && rims[id] != null)
	{
		if(res[id] == -1)
		{
			onRAMOV(rims[id]);
		}
		else if(res[id] == -2)
		{
			onRBMOV(rims[id]);
		}
	}
	rls[id].style.background = '';
	rls[id].style.color = '#4D994C';
	if(rfs[id]>=0)
	{
		ormot(rfs[id]);
	}
}
function rk(id)
{
	if(id>=0 && id<rss.length)
	{
		var d = rds[id];
		res[id]=-res[id];
		if(res[id]>0)
		{
			if(res[id]==1)
			{
				onRAMOT(rims[id]);
			}
			else
			{
				onRBMOT(rims[id]);
			}
			for(var i=id+1; i<rss.length && rds[i]>d; i++)
			{
				if(rss[i]<0)
				{
					rss[i]=id;
					rrs[i].style.display="none";
				}
			}
		}
		else
		{
			if(res[id]==-1)
			{
				onRAMOV(rims[id]);
			}
			else
			{
				onRBMOV(rims[id]);
			}
			for(var i=id+1; i<rss.length && rds[i]>d; i++)
			{
				if(rss[i]==id)
				{
					rss[i]=-1;
					rrs[i].style.display="";
				}
			}
		}
	}
}


function ocmov(id)
{
	if(id<cims.length && cims[id] != null)
	{
		if(ces[id] == -1)
		{
			onCAMOT(cims[id]);
		}
		else if(ces[id] == -2)
		{
			onCBMOT(cims[id]);
		}
	}
	cls[id].style.background = '#5977B3';
	cls[id].style.color = '#ffffff';
	if(cfs[id]>=0)
	{
		ocmov(cfs[id]);
	}
}
function ocmot(id)
{
	if(id<cims.length && cims[id] != null)
	{
		if(ces[id] == -1)
		{
			onCAMOV(cims[id]);
		}
		else if(ces[id] == -2)
		{
			onCBMOV(cims[id]);
		}
	}
	cls[id].style.background = '';
	cls[id].style.color = '#5977B3';
	if(cfs[id]>=0)
	{
		ocmot(cfs[id]);
	}
}
function ck(id)
{
	if(id>=0 && id<css.length)
	{
		var d = cds[id];
		ces[id]=-ces[id];
		if(ces[id]>0)
		{
			if(ces[id]==1)
			{
				onCAMOT(cims[id]);
			}
			else
			{
				onCBMOT(cims[id]);
			}
			for(var i=id+1; i<css.length && cds[i]>d; i++)
			{
				if(css[i]<0)
				{
					css[i]=id;
					crs[i].style.display="none";
				}
			}
		}
		else
		{
			if(ces[id]==-1)
			{
				onCAMOV(cims[id]);
			}
			else
			{
				onCBMOV(cims[id]);
			}
			for(var i=id+1; i<css.length && cds[i]>d; i++)
			{
				if(css[i]==id)
				{
					css[i]=-1;
					crs[i].style.display="";
				}
			}
		}
	}
}
